//package com.yokead.controller.tongji;
//
//import cn.jiangzeyin.common.JsonMessage;
//import com.yokead.common.Config;
//import com.yokead.common.base.AdminBaseControl;
//import com.yokead.common.tools.UrlPath;
//import com.yokead.controller.copy.CopyIndexControl;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import java.io.IOException;
//import java.text.ParseException;
//
///**
// * Created by jiangzeyin on 2017/8/9.
// */
//@Controller
//@RequestMapping("tongji")
//public class TongJiIndexControl extends AdminBaseControl {
//
//
//    @RequestMapping(value = "index.html", produces = MediaType.TEXT_HTML_VALUE)
//    public String index(String name) throws IOException {
//        setAttribute("data", CopyIndexControl.getInfo(UrlPath.Type.None, name, Config.Nginx.getNginxConfigPath()));
//        return "tongji/index";
//    }
//
//    @RequestMapping(value = "details.html", produces = MediaType.TEXT_HTML_VALUE)
//    public String details(String url) throws IOException {
//        return "tongji/details2";
//    }
//
//    /**
//     * 获取数据详情
//     *
//     * @param url
//     * @param dateType
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ResponseBody
//    public String data(String url, String dateType, String startTime, String endTime, String dime) throws ParseException {
//        if ("day".equals(dime)) {
//            TimesUtil timesUtil = new TimesUtil(TimesUtil.Type.Click);
//            return timesUtil.run(url, startTime, endTime, dateType);
//        }
//        if ("hours".equals(dime)) {
//            TimesUtil timesUtil = new TimesUtil(TimesUtil.Type.ClickHours);
//            return timesUtil.run(url, startTime, endTime, dateType);
//        }
//        return JsonMessage.getString(100, "时间维度不正确");
//    }
//
//    /**
//     * 状态码
//     *
//     * @param url
//     * @param dateType
//     * @param startTime
//     * @param endTime
//     * @return
//     * @throws IOException
//     */
//    @RequestMapping(value = "data_status.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ResponseBody
//    public String data(String url, String dateType, String startTime, String endTime) throws ParseException {
//        TimesUtil timesUtil = new TimesUtil(TimesUtil.Type.Status);
//        return timesUtil.run(url, startTime, endTime, dateType);
//    }
//}
